package com.cskaoyan._14network._01netAddress;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author Macro_Ray
 * @since 2024/3/25 20:28
 */
public class Demo1 {
    public static void main(String[] args) throws UnknownHostException {
//        static InetAddress getByName(String host)   确定主机名称的IP地址
//        String getHostName()       获取此IP地址的主机名
//        String getHostAddress()    返回文本现实中的IP地址字符串


        // 获取InetAddress对象
        InetAddress address = InetAddress.getByName("东东的好大儿");
        System.out.println(address);

        String name = address.getHostName();
        System.out.println(name);


        String ip = address.getHostAddress();
        System.out.println(ip);

    }
}
